package model;

/**
 * Represents a rational number by wrapping a {@code double}.
 * 
 * @author Henrik Wall
 * @author Rudolf Schmidt
 * @author Eugen Nemirowski
 */
public class Rat {
	/**
	 * Represents the {@link Number} value that will be wrapped.
	 */
	private final Number value;

	/**
	 * Constructor for {@link Rat}.
	 * 
	 * @param value
	 *            the wrapped {@code double}
	 */
	public Rat(final double value) {
		this.value = value;
	}
	@Override
	public boolean equals(final Object obj) {
		if (obj instanceof Rat) {
			return getValue().doubleValue() == ((Rat) obj).getValue().doubleValue();
		}
		return false;
	}
	/**
	 * @return the wrapped {@link Number}
	 */
	public Number getValue() {
		return value;
	}
	@Override
	public String toString() {
		return "[" + String.valueOf(getValue()) + ":" + getClass().getSimpleName() + "]";
	}
}
